/****************************************************************************

 Copyright (C) 2009 Jean Pierre Charalambos. All rights reserved.

 Jean Pierre Charalambos (http://dis.unal.edu.co/profesores/pierre/) is an
 Affiliate Associate Professor of the Faculty of Engineering at National
 University of Colombia (http://www.unal.edu.co/).

 This file is part of maku version 0.2.

 http://code.google.com/p/maku/
 email: jpcharalambosh@unal.edu.co

 This file may be used under the terms of the GNU General Public License
 versions 2.0 or 3.0 as published by the Free Software Foundation and
 appearing in the COPYING file included in the packaging of this file.

 This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

*****************************************************************************/

#ifndef SIMPLESCENE_H
#define SIMPLESCENE_H

#include <QGraphicsScene>
#include <QColor>

class QAction;

#include "unline.h"

class SimpleScene : public QGraphicsScene {

        Q_OBJECT

    public:

        SimpleScene ( QObject * parent = 0 ) : QGraphicsScene ( parent ), lineColor ( QColor ( Qt::black ) ), line ( 0 ) {
            createActions();
            setSceneRect ( -300, -300, 600, 600 );
            setItemIndexMethod ( QGraphicsScene::NoIndex );
        }
        //SimpleScene(QObject * = 0);

        ~SimpleScene();

        //actions and menus are public so that mainwindow can access them
        QAction *lineColorAction;

    public slots:
        void setLineColor();

    protected:
        void mousePressEvent ( QGraphicsSceneMouseEvent *mouseEvent );
        void mouseMoveEvent ( QGraphicsSceneMouseEvent *mouseEvent );
        void mouseReleaseEvent ( QGraphicsSceneMouseEvent *mouseEvent );
        QColor lineColor;

    private:
        void createActions();
        QGraphicsLineItem *line;
        QPointF initPos;
};

#endif
